import axios from 'axios'
import {Indicator} from 'mint-ui'


const requst=axios.create({
    baseURL:"https://www.only.cn/api/goods/dmpRecommendGoods?projectName=firstPageHot&brand=one&userId=&brandCode=ONLY"
})

export const response=axios.create({
    baseURL:"https://m.only.cn/classify/h5/ONLY/h5_list.json"
})

export const user=axios.create({
    baseURL:"http://rap2api.taobao.org/app/mock/86931/login"
})

requst.interceptors.request.use(res=>{
    Indicator.open('加载中');
    return res
})


response.interceptors.request.use(res=>{
    Indicator.open('加载中');
    return res
})

requst.interceptors.response.use(res=>{
    Indicator.close();
    return res.data.data
})

response.interceptors.response.use(res=>{
    Indicator.close();
    return res.data.data
})

user.interceptors.request.use(req=>{
    Indicator.close();
    req.headers.data=req.data
    console.log(req)
    return req
})

user.interceptors.response.use(res=>{
    Indicator.close();
    return res.data
})


export default requst;